using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class YardShipSelectItem : MonoBehaviour
{
    public Ship ship { set { m_Ship = value; }get { return m_Ship; } }
    public Image m_Preview;
    public Text m_NameL;
    public YardShipSelectList m_List;

    Ship m_Ship;
    void Start()
    {
        
    }

    void Update()
    {
        
    }
    public void Init(Ship ship, YardShipSelectList list)
    {
        if(list)
            m_List = list;
        m_Ship = ship;
        m_NameL.text = m_Ship.m_TypeName;
        if(m_Ship.GetComponent<SpriteRenderer>())
            m_Preview.sprite = m_Ship.GetComponent<SpriteRenderer>().sprite;
    }
    public void OnSelctedClicked()
    {
        m_List.OnItemSelected(this);
    }
}
